package gameengine;
import gameobjects.Platform;

import java.util.ArrayList;
import java.util.Collections;

public class PlatformMgr {

	private ArrayList<Platform> platformList;
	
	public PlatformMgr(){
		resetPlatformList();
	}
	
	public void addPlatform(int x, int y, int w){
		platformList.add(new Platform(x,y,w));
	}
	
	public void resetPlatformList(){
		platformList = new ArrayList<Platform>();
	}
	
	public ArrayList<Integer> getPlatformsAt(int x){
		ArrayList<Integer> returnList = new ArrayList<Integer>();
		returnList.add(0);
		for (int i = 0; i < platformList.size(); i++) {
			Platform temp = platformList.get(i);
			if (x >= temp.getX() && x <= temp.getX() + temp.getW())
				returnList.add(temp.getY());
		}
		Collections.sort(returnList);
		return returnList;
	}
}
